<template>
	<view class="content">
		<view class="padding_lrb">
			<view class="zwtimg placeholderimg flexcenter" style="margin-top: 300rpx;"
				v-if="releaseList.data.length==0">
				<image src="@/static/image/bg-icons/placeholderimg.png" mode=""></image>
			</view>
			<view class="center" v-for="item in releaseList.data" :key="item.id">
				<view class="flexbetween flex_wrap">
					<view class="flexleft">
						<view class="image_ya">
							<image :src="item.user.avatar_text" mode=""></image>
						</view>
						<view class="center_zi ">
							<view class="word_hei">{{item.user.nickname}}</view>
							<view class="hui" style="margin-top: 5rpx;">{{item.createtime_text}}</view>
						</view>
					</view>
				</view>
				<view class="TV">
					<view class="hei margin_top">{{item.title}}</view>
				</view>
				<view class="matter margin_top2">
					{{item.content}}
				</view>
				<!-- 图片 -->
				<view class="flexleft flex_wrap border_2">
					<view class="item_image_box margin_top flexcenter" v-for="value in item.images_text" :key="value">
						<view class="item_image">
							<image :src="value" mode=""></image>
						</view>
					</view>
				</view>
				<view class="flexaround margin_top">
					<view class="flexleft" @click="editInvitation(item)">
						<view class="bianji margin_right1"></view>
						<view class="nostrongtext">编辑</view>
					</view>
					<view class="flexleft" @click="publicInvitation(item)">
						<view class="margin_right1">
							<image src="../static/image/home/eyes.png" mode="" class="eyes"
								v-show="item.open_status==1"></image>
							<image src="../static/image/my/close.png" mode="" class="eyes" v-show="item.open_status==2">
							</image>
						</view>
						<view class="nostrongtext" v-show="item.open_status==1">公开</view>
						<view class="nostrongtext" v-show="item.open_status==2">私密</view>
					</view>
					<view class="flexleft" @click="deleteInvitation(item)">
						<view class="del margin_right1"></view>
						<view class="nostrongtext">删除</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				releaseList: {
					data: []
				}
			}
		},
		onShow() {
			this.init()
		},
		methods: {
			init(isPage, page) { //帖子列表
				let _this = this
				httpRequest.request('/api/user/myInvitation', 'GET', {
					page: page || 1,
					limit: _this.limit,
				}).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.releaseList;
						if (isPage == true) {
							_this.releaseList.data = dataList.data.concat(resList.data);
						} else {
							this.releaseList = res.data
							_this.releaseList.data = resList.data;
						}
					} else if (res.code == 0) {
						httpRequest.toast(res.msg);
					} else {
						httpRequest.toast('网络开小差啦');
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.releaseList;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			publicInvitation(item) { //公开帖子
				let _this = this
				httpRequest.request('/api/user/openInvitation', 'GET', {
					id: item.id,
					open_status: item.open_status == 1 ? 2 : 1
				}).then(res => {
					if (res.code == 1) {
						httpRequest.toast(res.msg);
						_this.init()
					} else if (res.code == 0) {
						httpRequest.toast(res.msg);
					} else {
						httpRequest.toast('网络开小差啦');
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			editInvitation(item) { //编辑帖子
				uni.navigateTo({
					url: "/pages_post/fabutz?id=" + item.id
				})
			},
			deleteInvitation(item) { //删除帖子
				let _this = this
				httpRequest.modal('提示', '删除之后数据不可恢复！', true, (res) => {
					if (res) {
						httpRequest.request('/api/user/deleteInvitation', 'GET', {
							id: item.id,
						}).then(res => {
							if (res.code == 1) {
								httpRequest.toast(res.msg);
								_this.init()
							} else if (res.code == 0) {
								httpRequest.toast(res.msg);
							} else {
								httpRequest.toast('网络开小差啦');
							}
						}).catch(err => {
							httpRequest.toast(err.msg);
						})
					}
				})

			}
		}
	}
</script>

<style lang="scss" scoped>
	.matter {
		font-size: 26rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #666666;
	}

	.eyes {
		width: 31rpx;
		height: 25rpx;
	}

	.hui {
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #626365;
	}

	.chuzu_img {
		width: 132rpx;
		height: 132rpx;
		background-size: 100% 100%;
		border-radius: 15rpx 15rpx 15rpx 15rpx;

	}

	.chuzu {
		padding: 30rpx 30rpx;
		background-color: #fff;
		margin-top: 30rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;

	}

	.tubiao {
		width: 16rpx;
		height: 23rpx;
		margin-right: 14rpx;
	}

	.dizhi {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #333333;
	}


	.chuzu_a {
		padding-left: 19rpx;
		flex-grow: 1;
		align-self: flex-start;
	}

	.chuzu_center {
		padding-top: 14rpx;
	}

	.zhuying {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #000000;
		padding-left: 19rpx;
		padding-top: 24rpx;
		//超出两行省略号
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.image_ya {
		width: 77rpx;
		height: 77rpx;
		border-radius: 50%;

		image {
			width: 100%;
			height: 100%;
			border-radius: 50%;
		}
	}

	.item_image {
		width: 180rpx;
		height: 180rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.bottomline {
		padding-bottom: 30rpx;
		border-bottom: 1rpx solid rgba(0, 0, 0, .01);
	}

	.addresstext {
		font-size: 24rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #000000;
		text-align: center;
		width: 200rpx;
	}

	.wdfb {
		background-color: #F1F1F1;
	}

	.right_icon {
		margin-left: 9rpx;
	}

	.active {
		color: #228DFF;
	}

	.actived {
		color: #FFA500;
	}

	.lan {
		background: RGBA(233, 244, 255, 1);
		border-radius: 41rpx 41rpx 41rpx 41rpx;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #228DFF;
		padding: 20rpx 43rpx 21rpx 43rpx;
		margin: 30rpx 0rpx 0rpx 28rpx;
	}

	.pu {
		background: RGBA(247, 249, 250, 1);
		border-radius: 41rpx 41rpx 41rpx 41rpx;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
		padding: 20rpx 43rpx 21rpx 43rpx;
		margin: 30rpx 0rpx 0rpx 28rpx;
	}

	.center {
		margin-top: 30rpx;
		background-color: #fff;
		padding: 30rpx 30rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.city {
		font-size: 24rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #000000;
	}

	.header {
		margin-top: 30rpx;
		background-color: #fff;
		padding: 27rpx 28rpx 27rpx 28rpx;
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #666666;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.gray {
		width: 8rpx;
		height: 12rpx;
		background-size: 100% 100%;
		padding-left: 6rpx;
	}

	// 
	.nav_b {
		padding: 36rpx 32rpx;
		background-color: #fff;
	}

	.right_henan {
		width: 360rpx;
		font-size: 30rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #000000;
		padding-left: 19rpx;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}

	.puhuo {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #228DFF;
		padding: 4rpx 18rpx 4rpx 18rpx;
		background-color: RGBA(233, 244, 255, 1);
		margin-top: 14rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		margin-left: 14rpx;
	}

	.address {
		width: 280rpx;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #333333;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}

	.km {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #228DFF;
		padding-left: 16rpx;
	}

	.add {
		margin-top: 40rpx;
		border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
		padding-bottom: 36rpx;
	}

	.ii {
		margin-right: 22rpx;
	}

	.liu {
		padding-top: 30rpx;
	}

	.liulan {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #666666;
	}

	.nav_a {
		background: #FFFFFF;
		margin: 30rpx 0rpx 0rpx 0rpx;
	}

	.zhida {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #228DFF;
		border: 1rpx solid rgba(34, 141, 255, 1);
		padding: 0rpx 10rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
	}

	.zhida2 {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #228DFF;
		border: 1rpx solid rgba(34, 141, 255, 1);
		padding: 0rpx 10rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
	}

	.zhongzhuan {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFA500;
		border: 1rpx solid rgba(255, 165, 0, 1);
		padding: 0rpx 10rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
	}

	.zhengzhou {
		padding: 0rpx 20rpx 0rpx 14rpx;
		font-size: 24rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #000000;
	}

	.zd {
		padding: 31rpx 32rpx;
	}

	.luoyang {
		font-size: 24rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #000000;
		padding: 0rpx 20rpx;
	}

	.xiangqing {
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
		padding-right: 11rpx;
		padding-left: 261rpx;
	}

	.xian {
		border-bottom: 2rpx solid RGBA(247, 247, 247, 1);
	}

	.car_img {
		width: 132rpx;
		height: 132rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
	}

	// 


	.city {
		font-size: 34rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #000000;
		padding-left: 12rpx;
	}

	.nav_header {
		padding-bottom: 32rpx;
		border-bottom: 1rpx solid RGBA(247, 247, 247, 1);
	}

	.look {
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
	}

	.form {
		text-align: center;
		padding-top: 54rpx;
		padding-bottom: 61rpx;
	}

	.transport {
		height: 200rpx;
		padding: 0rpx 30rpx;
		overflow-x: hidden;
	}

	.chongzhi {
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #228DFF;
		border: 1rpx solid #228DFF;
		border-radius: 41rpx 41rpx 41rpx 41rpx;
		padding: 20rpx 128rpx 17rpx 129rpx;
	}

	.queren {
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #fff;
		background-color: rgba(34, 141, 255, 1);
		border: 1rpx solid #228DFF;
		border-radius: 41rpx 41rpx 41rpx 41rpx;
		padding: 20rpx 128rpx 17rpx 129rpx;
	}

	.footer {
		padding: 72rpx 30rpx;
	}

	.center_zi {
		padding: 0rpx 20rpx;
	}

	.hui_zi {
		font-size: 26rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #666666;
		padding-top: 24rpx;
		//超出两行省略号
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.item_image_box {
		width: 33.33%;
	}

	.centers {
		margin-top: 30rpx;
		font-size: 28rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #000000;
	}

	.center_a {
		padding: 100rpx 0rpx 30rpx 0rpx;
		background-color: #ffff;
	}

	.bottom_zi {
		padding-top: 30rpx;
	}

	.all {
		background: #fFF;
		border-radius: 11rpx 0rpx 0rpx 11rpx;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #228DFF;
		padding: 11rpx 38rpx;
		border: 2rpx solid #228DFF;
	}

	.alls {
		background: #228DFF;
		border-radius: 0rpx 11rpx 11rpx 0rpx;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #ffff;
		padding: 11rpx 38rpx;
		border: 2rpx solid #228DFF;
	}

	.xuqui {
		background: #fff;
		color: #228DFF;
		border: 2rpx solid #228DFF;
	}

	.gongying {
		background: #228DFF;
		color: #ffff;
		border: 2rpx solid #228DFF;
	}

	.quigou {
		color: #228DFF;
	}
</style>